{extend name='index@Common/index' /} {block name='content'}

<div class="card">
  <div class="card-body fs-12">
    <div class="cont-box">
      <div class="col-12 px-0 fs-16">
        <div class="form-inline">
          <div class="col-3 p-0">
            <span><i class="iconfont icon-icon_duihao-xian color-green fs-20 pr-2"></i>您的订单已提交，请支付。</span>
          </div>
          <div class="col-9 text-right px-5">
            <span>待支付总金额</span><span class="fs-20 fc-red money ml-3">{:number_format($money,2)}</span>
          </div>
        </div>
      </div>
      <div class="col-12 p-0">
        <div class="py-3">
          <div class=" bg-f5 p-3">
            <div class="form-row">
              <div>
                <label class="col-form-label">订单编号：</label>
                <span>{$_GET['order']} <a href="{:url('index/Billing/order')}">查看&nbsp;&gt;&gt;</a></span>
              </div>
            </div>
            <div class="form-row">
              <label class="col-form-label p-0">产品信息：</label>
              <div class="col">
                <ul class="p-0 mb-0" style="list-style-type: none">
                  {if $prolist == '0'}
                  账户充值
                  {else /}
                  {foreach name="prolist" item="v"}
                  <?php $v = object_toArray($v); ?>
                  <li>{$v.class}</li>
                  {/foreach}
                  {/if}
                </ul>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="col-12 p-0 ">
        <div class="form-group">
          <label for="" class="col-form-label fs-16 border-left py-0 px-2"> 选择支付方式</label>
          <div class="col">

          </div>
        </div>
      </div>
      <div class="col-12 border border-b-0 form-inline">
        <div class="form-group form-row p-2">
          <div class="col p-1">
            <div
              class="custom-control custom-radio custom-control-inline {if (double)$money> (double)$userinfo['balance']}disabled{/if}">
              <input type="radio" id="allwarehouse" name="outboundorder" class="custom-control-input" value="0" {if
                (double)$money> (double)$userinfo['balance']}disabled{else/}checked{/if}>
              <label class="custom-control-label " style="top:0px" for="allwarehouse">账户余额：（可用 <span
                  class="money ml-1">{:number_format($userinfo['balance'],2)}</span>）</label>
            </div>
          </div>
        </div>
      </div>
      <div class="col-12 border border-top-0 ">
        <div class="form-row p-2">
          <div class="col-1 py-1">
            <div class="custom-control custom-radio custom-control-inline">
              <input type="radio" id="allwarehouse1" name="outboundorder" class="custom-control-input" value="1" {if
                (double)$money> (double)$userinfo['balance']}checked{/if}>
              <label class="custom-control-label " style="top:0px" for="allwarehouse1">在线支付： </label>
            </div>
          </div>
          <div class="col onlineshow {if (double)$money> (double)$userinfo['balance']}{else/}d-none {/if}">
            <span class="">需支付</span><span class="fc-red fs-20 money ml-3">{:number_format($money,2)}</span>
          </div>
        </div>
        <div class="mb-2 form-row">
          <div class="col px-2">
            <div class="pay-list">
              <div class="rc-group px-1">
                <!-- <input type="radio" name="caType" value="1" autocomplete="off" id="caType1" disabled="true" {if (double)$money> (double)$userinfo['balance']}checked="" {/if}>
                                <label class="rc-group-item wh-120" for="caType1"><span class="iconfont icon-zhifupingtai-yinlian pr-2"></span>银联个人</label> -->
                <input type="radio" name="caType" value="2" autocomplete="off" id="caType2" disabled="true">
                <label class="rc-group-item wh-120" for="caType2"><span
                    class="iconfont icon-zhifubao pr-2"></span>支付宝</label>
                <!-- <input type="radio" name="caType" value="3" autocomplete="off" id="caType3" disabled="true">
                                <label class="rc-group-item wh-120" for="caType3"><span class="iconfont icon-weixinzhifu pr-2"></span>微信支付</label> -->
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="col-12 py-3 p-0">
        <div class=" form-row">
          <div class="col">
            <button class="btn btn-danger fs-12 toBuy">确认支付</button>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{/block} {block name='js'}
<div class="modal fade" id="waitpay" tabindex="-1" role="dialog" aria-labelledby="waitpay" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">付款完成前请不要关掉页面</h5>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
          <button type="button" class="btn btn-primary btn-sm mr-3">完成付款</button>
        <button type="button" class="btn btn-info btn-sm" data-dismiss="modal">提交工单</button>
      </div>
    </div>
  </div>
</div>
<style>
  .rc-group input[type='radio']:disabled+label,
  .rc-group input[type='checkbox']:disabled+label {
    background-color: transparent;
    color: #666666;
  }
</style>
<script>
  $('[name="outboundorder"]').change(function () {
    if (Number($(this).val())) {
      $('.onlineshow').removeClass('d-none');
      $('[name="caType"]').eq(0).prop('checked', true);
      $('[name="caType"]').prop('disabled', false);
    } else {
      $('.onlineshow').addClass('d-none');
      $('[name="caType"]').prop('checked', false);
      $('[name="caType"]').prop('disabled', true);
    }
  });
  $('.toBuy').click(function () {
    ajax('{:url("index/Buy/pay")}', {
      order: "{$_GET['order']}",
      type: $('[name="outboundorder"]:checked').val()
    }, 'post').then(e => {
      if (typeof e == 'string') {
        var win = window.open('about:blank');
        win.document.write(`<div class="d-none">${e}</div>`);
      } else {
        if (e.status == 200) {
          window.location.href = '{:url("index/Buy/paystatus",["status"=>1])}';
        } else {
          alert(e.msg);
          // window.location.href = '{:url("index/Buy/paystatus",["status"=>0])}';
        }
      }
      console.log(e);
    });
  });
</script>
{/block}